import axios from 'axios';
import { reactive } from 'vue'

export default function () {
    //数据
    let dogList = reactive<string[]>([])

    //方法
    const addDog = async () => {
        try {
            let res = await axios.get('https://dog.ceo/api/breed/pembroke/images/random');
            dogList.push(res.data.message)
        }
        catch (error) {
            alert(error)
        }
    }
    //向外部暴露数据和方法
    return { dogList, addDog }
}
